package com.ushine.design.design.c_behavioral_pattern.f_memento.a_practice;

public class Originator {
    private String state;

    public Originator(String state) {
        this.state = state;
    }

    public Memento createMemento() {
        return new Memento(this);
    }

    //根据备忘录对象恢复到原发器状态
    public void restoreMenento(Memento memento) {
        state = memento.getState();
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getState() {
        return state;
    }
}
